#ifndef _H_I_SWAPABLE_BUFFER_H_
#define	_H_I_SWAPABLE_BUFFER_H_

#include "../typedefine.h"
#include "../PairDefine.h"

namespace QWER
{
	QDLL_EXPORT QSTRUCT SReplaceRet
	{
	public:
#ifdef _USING_CLI
		SReplaceRet(array<UINT8>^ poBuffer, UINT32 dwSize)
		{
			m_poBuffer = poBuffer;
			m_dwSize = dwSize;
		}
#else
		SReplaceRet(){}
		SReplaceRet(UINT8* poBuffer, UINT32 dwCapacity, UINT32 dwSize)
		{
			m_poBuffer = poBuffer;
			m_dwCapacity = dwCapacity;
			m_dwSize = dwSize;
		}
#endif

	public:
#ifdef _USING_CLI
		QINIT_ONLY array<UINT8>^ STRUCT_MEMBER_DEFINE(m_poBuffer, NULL_PTR);
#else
		QINIT_ONLY UINT8* m_poBuffer = NULL_PTR;
		QINIT_ONLY UINT32 m_dwCapacity = 0;
#endif
		QINIT_ONLY UINT32 STRUCT_MEMBER_DEFINE(m_dwSize, 0);
	};

	QDLL_EXPORT QINTERFACE ISwapableBuffer
	{
	public:
#ifdef _USING_CLI
		virtual SReplaceRet ReplaceBuffer(CONST_REF(SReplaceRet) sBuffer) = 0;
#else
        virtual ~ISwapableBuffer() {}
		virtual SReplaceRet ReplaceBuffer(CONST_REF(SReplaceRet) sBuffer) = 0;
#endif
	};

	QDLL_EXPORT QCLASS CSwapableBufferHelper
	{
	public:
		static void Swap(PTR_OR_REF(ISwapableBuffer) roBuffer1, PTR_OR_REF(ISwapableBuffer) roBuffer2);
	};
};

#endif

